package com.mengxuegu.springboot.controller;

import com.mengxuegu.springboot.entities.User;
import com.mengxuegu.springboot.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class UserController {
    @Autowired
    private IUserService userService;

    @GetMapping("/user/{id}")
    public User getBill(@PathVariable("id") Integer id) {
        User user = userService.getById(id);
        return user;
    }

    @PostMapping("/user")
    public Boolean getBill(@RequestBody User user) {
        boolean save = userService.save(user);
        return save;
    }

    @PostMapping("/updateUser")
    public Boolean updateUser(@RequestBody User user) {
        int i = userService.updateUser();
        return false;
    }
}
